﻿/// <reference path="../../js/jquery-1.11.1.min.js" />
/// <reference path="../../js/jquery-1.11.0-vsdoc.js" />

function DialogBtnSave_OnClick()
{  
    try
    {
     var abool=isDate($("#txtINVOICES_DATE").val());
  //就是這下面這一行，花了我大半天找問題…
    
		$("#lblINVOICES_NO_ERR").text("");
		$("#lblINVOICES_DATE_ERR").text("");
		$("#lblINVOICES_AMT_ERR").text("");
    	//存檔檢核
    	//Modify By EmilyLi On 2008/09/16 : 取消發票號碼限制為數字的判斷 
    	//Modify By EmilyLi On 2008/09/17 : 取消發票號碼限制為8碼的判斷 
    	//Modify By EmilyLi On 2008/09/18 : 新增發票日期為8(yyyymmdd)碼的檢核
    	if($("#txtINVOICES_NO").val()!="")
    	{
    		//if(isNaN(document.all.txtINVOICES_NO.value))
    		//{
    		//	document.all.lblINVOICES_NO_ERR.innerText=GetMessageByID("MSG024").text;
    		//}
    		//else
    		//{
    			//if(document.all.txtINVOICES_NO.value.length!=8)
    			//{
    			//	document.all.lblINVOICES_NO_ERR.innerText=GetMessageByID("MSG065").text;
    			//}
    		//}
    	}
    	else
    	{
    		$("#lblINVOICES_NO_ERR").text(GetMessageByID("MSG019").text);
    	}
    	
    	if($("#txtINVOICES_AMT").val()!="")
    	{
    		if(isNaN($("#txtINVOICES_AMT").val()))
    		{
    			$("#lblINVOICES_AMT_ERR").text(GetMessageByID("MSG024").text);
    		}
    	}
    	else
    	{
    		$("#lblINVOICES_AMT_ERR").text(GetMessageByID("MSG019").text);
    	}
    	
    	
    	if($("#txtINVOICES_DATE").val() !="")
    	{
    		if(!isDate($("#txtINVOICES_DATE").val()))
			{
				$("#lblINVOICES_DATE_ERR").text(GetMessageByID("MSG021").text);
			}
			
			/*else
			{
				var ServerDate=getServerInfoByClient("date");
				if(document.all.txtINVOICES_DATE.value < ServerDate)
				{
					document.all.lblINVOICES_DATE_ERR.innerText=GetMessageByID("MSG062").text;
				}
			}*/
    	}
    	else
    	{
    		$("#lblINVOICES_DATE_ERR").text(GetMessageByID("MSG019").text);
    	}
		
    	if ($("#lblINVOICES_NO_ERR").text() == "" && $("#lblINVOICES_DATE_ERR").text() == "" && $("#lblINVOICES_DATE_ERR").text() == "")
		{
			return true;
		}
		else
		{
			alert(GetMessageByID("MSG020").text);
			return false;
		}
		
    }
	catch (e)
	{
        alert(e.Message);
        return false;
	}
	finally
	{
	
	}
}

//--------------------------------------------------------------------------------/
//維護程式 - 離開																  /
//功能:離開維護表單																  /
//函式名稱 = DialogBtnExit_OnClick												  /
//--------------------------------------------------------------------------------/
function DialogBtnExit_OnClick()
{
    this.close();
    return true;
}

function DialogBtnDEL_OnClick()
{
 
	    if(confirm(GetMessageByID("MSG064").text))
	    {
            return true;
	    }
	    else {
	        return false;
	    }
}





